﻿using B.S.Traceability.Domain;
using B.S.Traceability.Error;
using B.S.Traceability.Read.API.Application.Commends;
using B.S.Traceability.Read.API.Dto;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Traceability.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TraceabilityController : ControllerBase
    {


        private readonly IMediator mediator;

        public TraceabilityController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 显示商品名称
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public Task<APIResult<List<Shoops>>> QueryShoop([FromQuery]QueryShoopCommends request, CancellationToken cancellationToken) { 
            return mediator.Send(request, cancellationToken);
        }


        /// <summary>
        /// 获取生产信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public Task<APIPaging<List<ProductsShoopDtos>>> GetProductsShoop([FromQuery]ProductsShoopCommends request, CancellationToken cancellationToken)
        {
            return mediator.Send(request, cancellationToken);
        }

    }
}
